<template>
	<view class="merchant-settlement">
		<image class="settlement-img"
			src="https://jjzus.oss-cn-hangzhou.aliyuncs.com/5a8f26af43794b019d321a3edd71c762.jpg"></image>
		<view class="settlement-buttom">
			<view class="settlement-title">
				<span class="title">全国租赁商火热报名中</span>
			</view>
			<view class="settlement-btn">
				<view class="left" @click="phoneClick(true)"><span class="phone">电话咨询</span></view>
				<view class="right" @click="merchantClick(true)"><span class="apply">申请入驻</span></view>
			</view>
		</view>
		<wyb-popup ref="contactNumber" type="center" width="638" height="303" radius="6">
			<view class="settlement-popup">
				<view class="contact-title">服务热线</view>
				<view class="contact-info">确认拨打{{telPhone}}服务热线吗？</view>
				<view class="contact-btn">
					<text class="left" @click="phoneClick(false)">取消</text>
					<text class="right" @click="callPhone()">确认</text>
				</view>
			</view>
		</wyb-popup>

		<wyb-popup ref="merchantInfo" type="center" width="638" height="678" radius="6">
			<view class="settlement-popup">
				<view class="merchant-title">立即申请报名入驻</view>
				<view class="merchant-form">
					<view class="label star">姓名</view>
					<input :class="status === 'name' ? 'on' : ''" class="input" @input="(e) => changeList(e, 'name')"
						placeholder="请输入您的姓名" />
				</view>
				<view class="merchant-form">
					<view class="label star">联系电话</view>
					<input :class="status === 'phone' ? 'on' : ''" class="input" @input="(e) => changeList(e, 'phone')"
						placeholder="请输入您的联系电话" />
				</view>
				<view class="merchant-form" @click="$refs.cityPicker.show()">
					<view class="label none">所在城市</view>
					<input class="input" disabled :value="adress" placeholder="请输入您的所在城市" />
				</view>
				<view class="merchant-form">
					<view class="label none">行业</view>
					<input class="input" @input="(e) => changeList(e, 'industry')" placeholder="请输入您的行业" />
				</view>
				<view class="merchant-butn" @click="submit">申请入驻</view>
			</view>
		</wyb-popup>
		<view class="merchant-city">
			<gk-city ref="cityPicker" :pickerSize="2" headtitle="请选择所在区域" :provincedata="provincedata"
				@funcvalue="getParentValue"></gk-city>
		</view>
	</view>
</template>

<script>
	import gkCity from "@/components/gk-city-rich/gk-city-rich.vue";
	import wybPopup from "../../components/wyb-popup/wyb-popup.vue";
	export default {
		data() {
			return {
				provincedata: [{
					text: "请选择",
					value: ""
				}],
				industry: "",
				adress: "",
				list: {},
				status: "",
				telPhone: '',


				//下面是没用的垃圾混淆代码
				renzhengTimeSta1111111: true, //初次请求认证时间默认是带有的，
				zhuceTimeSta11111: false, //初次请求注册时间默认是没有的
				renzhengTimeList11111: [],
				zhuceTimeStaList1111: null,
				detailOrderIdStr11111: '',
				threeTabCurrent1111: 0,
				applyGOodsList11111: [], //供货商列表
				allCardEnterSta1111: false, //默认是false，点击批量卡券入库的时候变为true
				codeAddNumsList11111: [],
				numsList11111: [],
				dataSourceBqcp1111: [],
				selectedRowKeys1111: [],
				selectedRowKeysB11111: [],
				rkVisible11111: false,
				rkjlVisible1111: false,
				lhjlVisible1111: false,
				currentStyleData22222: {},
				dataSourceStyle2222: [],
				showStyleData2222: false,
				indexTemplate2222: [],
				SVGCircleElement3ee: '',
				vshoweqwsc1111: false,
				showStyleDataInfo2222: false,
				opeCategoryList2222: [],
				leimuVisible2222: false,
				selectedRowKeys02222: [],
				selectionRows02222: [],
				selectedRowKeys133333: [],
				selectionRows13333: [],
				selectedRowKeys2333: [],
				selectionRows23333: [],
				selectedRowKeys33333: [],
				selectionRows33333: [],
				selectedRowKeys4333: [],
				selectionRows43333: [],
				curwfqwrentStyleDaterwaInfo444: {},
				currwerentStywerleDatweraInfo1444: {},
				currewerntStyleDataInfo24444: {},
				currentweStyleDytuataIwenfo34444: {},
				currenwetStdfgyleDataInfo44444: {},
				checkZfbPhone_h5444: '',
				plNafgdvfdtjyme4444: '', //四大品类的名字
				uniPdfgrtylatform444: '', //运行环境mp-alipay mp-weixin
				refgjtytrsemark555: '', //备注
				timefgjSelStr5555: '', //选择的上门时间（2023-08-31 00:00:00）
				amOdcuiofasrpm5555: '', //选择的上门时间是上午还是下午
				pageShnjlkgohowTime5555: '', //页面上用户看到的显示的时间
				paraghsdfmsw454: {},
				valhgujtueNum56756: 0,
				addrdraess56756: {}, //上门收货地址
				adawerterydressId575: 0,
				sceoyuitne57567: '',
				tntuiopId56757: '',
				weictyuratCustomer5756: '',
				yuidurtyuoy567567: false,


				//下面是没用的垃圾混淆代码
				renzhengTimeSta1111111: true, //初次请求认证时间默认是带有的，
				zhuceTimeSta11111: false, //初次请求注册时间默认是没有的
				renzhengTimeList11111: [],
				zhuceTimeStaList1111: null,
				detailOrderIdStr11111: '',
				threeTabCurrent1111: 0,
				applyGOodsList11111: [], //供货商列表
				allCardEnterSta1111: false, //默认是false，点击批量卡券入库的时候变为true
				codeAddNumsList11111: [],
				numsList11111: [],
				dataSourceBqcp1111: [],
				selectedRowKeys1111: [],
				selectedRowKeysB11111: [],
				rkVisible11111: false,
				rkjlVisible1111: false,
				lhjlVisible1111: false,
				currentStyleData22222: {},
				dataSourceStyle2222: [],
				showStyleData2222: false,
				indexTemplate2222: [],
				SVGCircleElement3ee: '',
				vshoweqwsc1111: false,
				showStyleDataInfo2222: false,
				opeCategoryList2222: [],
				leimuVisible2222: false,
				selectedRowKeys02222: [],
				selectionRows02222: [],
				selectedRowKeys133333: [],
				selectionRows13333: [],
				selectedRowKeys2333: [],
				selectionRows23333: [],
				selectedRowKeys33333: [],
				selectionRows33333: [],
				selectedRowKeys4333: [],
				selectionRows43333: [],
				curwfqwrentStyleDaterwaInfo444: {},
				currwerentStywerleDatweraInfo1444: {},
				currewerntStyleDataInfo24444: {},
				currentweStyleDytuataIwenfo34444: {},
				currenwetStdfgyleDataInfo44444: {},
				checkZfbPhone_h5444: '',
				plNafgdvfdtjyme4444: '', //四大品类的名字
				uniPdfgrtylatform444: '', //运行环境mp-alipay mp-weixin
				refgjtytrsemark555: '', //备注
				timefgjSelStr5555: '', //选择的上门时间（2023-08-31 00:00:00）
				amOdcuiofasrpm5555: '', //选择的上门时间是上午还是下午
				pageShnjlkgohowTime5555: '', //页面上用户看到的显示的时间
				paraghsdfmsw454: {},
				valhgujtueNum56756: 0,
				addrdraess56756: {}, //上门收货地址
				adawerterydressId575: 0,
				sceoyuitne57567: '',
				tntuiopId56757: '',
				weictyuratCustomer5756: '',
				yuidurtyuoy567567: false,
			};
		},
		onLoad(e) {
			this.telPhone = e.telPhone
		},
		methods: {
			phoneClick(bl = false) {
				bl ? this.$refs.contactNumber.show() : this.$refs.contactNumber.hide();
			},
			callPhone() {
				uni.makePhoneCall({
					phoneNumber: this.telPhone,
					success: () => {
						this.phoneClick(false);
					},
					fail: () => {
						this.phoneClick(false);
					},
				});
			},
			merchantClick(bl = false) {
				bl ? this.$refs.merchantInfo.show() : this.$refs.merchantInfo.hide();
			},
			changeList(e, k) {
				this.list[k] = e.detail.value;
			},
			getParentValue(e) {
				const vl =
					e.map((item) => {
						return {
							ky: item.value,
							vl: item.text,
						};
					}) || [];
				this.adress = vl[0].vl + " " + vl[1].vl;
				this.list = {
					...this.list,
					city: vl[0].ky,
					province: vl[1].ky,
					adress: this.adress,
				};
			},
			submit() {
				const pattern = /0?(13|14|15|18|17)[0-9]{9}/,
					list = this.list;
				if (!list.name || !list.phone) {
					this.status = !list.name ? "name" : "phone";
					console.log(this.status);
				} else {
					if (pattern.test(list.phone)) {
						const url = "member/mall/merchantSettlement/addMerchant";
						this.$request(url, list, "post").then((rs) => {
							this.merchantClick();
							uni.showToast({
								title: "客服将会在24小时内联系您，请保持电话畅通",
								icon: "none",
							})
						});
					} else this.status = "phone";
				}
			},
		},
		components: {
			wybPopup,
			gkCity,
		},
	};
</script>

<style lang="scss">
	@import "./index.scss";
</style>